package com.sprites;


import sheep.game.Sprite;
import android.graphics.Paint;

public abstract class AbstractSpecialBrick extends Brick {
	private float durationTime;

	/**
	 * 
	 * @param paint
	 *            The color of the brick
	 * @param value
	 *            The value of the brick(Number of points a player gets to
	 *            destroy the brick)
	 * @param durationTime
	 *            The time the special effect last
	 */
	public AbstractSpecialBrick(Paint paint, int value, float durationTime) {
		super(paint, value);
		this.durationTime = durationTime;
	}

	public float getDurationTime() {
		return durationTime;
	}

	/**
	 * Draw method
	 */
	public void draw(android.graphics.Canvas canvas) {
		super.draw(canvas);
	}

	/**
	 * Abstract method that adds an event to EventTimer. What kind of event is
	 * dependent on the class and thus specified in the subclass.
	 * 
	 * @param subject
	 */
	public abstract void addEvent(Object subject);

	/**
	 * Method that calls addEvent when a collision with ball has happened, and
	 * then removes the brick from the game
	 */
	public void collided(Sprite a, Sprite b) {
		if (b instanceof Ball) {
			if (((Ball) b).getCurrentOwner() != null) {
				((Ball) b).getCurrentOwner().addPointsToScore(getValue());
			}
			addEvent(b);
			destroy();
		}
	}
}
